home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / winprogs / wslpd / wslpd.exe / NETPRINT.TXT next >
Encoding:
Text File  |  1993-06-23  |  12.3 KB  |  293 lines

  1.           Winsock Print Manager and Print Spooler
  2.                 Version 1.0
  3.               Written by Dave Brooks
  4.               Design Specification by
  5.                   Robert Peterson
  6.               Idaho National Engineering Lab
  7.  
  8.  
  9.                  Table of Contents
  10.  
  11. Disclaimer
  12. Introduction
  13. Requirements to run this software
  14. Quick Start: How to Install it
  15. A few other things you Need to Know
  16.  
  17. Disclaimer
  18. ----------
  19.  
  20. Copyright 1993 Idaho National Engineering Labratory (INEL)
  21.  
  22. Permission to use, copy, modify, and distribute this software
  23. and its documentation for any legal purpose is hereby granted without
  24. fee, provided that the copyright notice and complete license agreement
  25. appear in all copies and all supporting documentation, and that, while
  26. the INEL is to be accredited with the development of the software,
  27. the name of the INEL is not to be used in advertising or publicity
  28. pertaining to the distribution of the software without prior written
  29. permission of Phil Simpson.  Should the software be modified, the
  30. modified files shall also carry prominent notices stating that the files
  31. have been changed and the date of such change.  The INEL makes no
  32. representations about the suitability of this software for any purpose.
  33. It is provided ``as is'' without express or implied warranty.
  34.  
  35. THE INEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  36. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL
  37. THE INEL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  38. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  39. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  40. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  41.  
  42. Introduction
  43. ------------
  44.  
  45. If you are familiar with the idea of printing from one system to a printer
  46. on remote system, and would like to set up your Microsoft Windows version
  47. 3.1 printer to be a compatible "remote" printer, then this is the software
  48. for you.  I use it regularly to print text from my Ultrix system, as do
  49. other folks in this vicinity from various Unix systems.
  50.  
  51. You can print using standard Unix "lpr" print client.  I've also used the
  52. sample print client from Stevens' famous "Network Programming" text, and
  53. a Macintosh "lpr" client.  Yes, folks, we printed text _directly_ from a
  54. Mac to a PC.
  55.  
  56. This package comes in two parts:
  57.  
  58. 1)  The 'Print Manager' is the part that speaks the network protocol.  For
  59. those of you into standards (and you wouldn't care about WinSock if you
  60. weren't), I used RFC 1179 as the reference rather than the Berkeley code.
  61.  
  62. 2)  The 'Spooler' takes the text and writes it to your Windows printer. 
  63.  
  64. Notes:
  65.  
  66. *   This software is engineered to run "unattended".  That is, after a
  67.     minimal amount of setup, you can put them in your StartUp group and
  68.     start printing to your PC from remote systems without manual
  69.     intervention.  In fact, if you are already running Windows and WinSock,
  70.     and have your printer configured to work with Windows, then all you'll
  71.     need to do to is to have a remote system configured to know about your
  72.     printer, and run this software.
  73.  
  74. *   It supports all five commands required in the RFC, namely 'print',
  75.     'display queue (short)', 'display queue (long)', 'remove job (jobs)',
  76.     and 'start printer'.
  77.  
  78.     The 'remove jobs' command supports removing by user or job numbers, and
  79.     does the usual checking for privilege.  It also recognizes the user
  80.     "root" as the "superuser", with the ability to remove any job.
  81.  
  82.     The 'start printer' command is not required to make this software work,
  83.     but it is supported and is useful in some circumstances (see the
  84.     "Things to Know" section below).
  85.  
  86. *   Only text is supported, but enough formatting characters are
  87.     understood so that you can print basic nroff output, like Unix man
  88.     pages.  For example:
  89.  
  90.         man X | lpr -Ppebbles
  91.  
  92.     works.  I'm sure that "tbl" output will not work, since I don't do any
  93.     line drawing.
  94.  
  95.     It would be nice to someday support PostScript (via ghostscript) and
  96.     other formats as 'helper' applications.
  97.  
  98. To reach me, here is the relevant information from my .signature file:
  99.  
  100. David L. Brooks
  101. Idaho National Engineering Lab.  INTERNET: dob@INEL.GOV
  102. POB 1625                         Phone: (208) 526-0826
  103. Idaho Falls, Id. 83415-3730     FAX:   (208) 526-9908
  104.  
  105. Requirements
  106. ------------
  107.  
  108. You'll need:
  109.  
  110. *   A PC with Microsoft Windows 3.1, and a supported network card.
  111. *   Windows Sockets 1.1 or better, installed and running.
  112. *   A printer that you have configured Windows to work with; if you can't
  113.     print from the Notepad, for example, then you can't print with this
  114.     software either.
  115. *   A remote system with a 'print' command that understands how to print to
  116.     Berkeley-compatible systems.  The BSD Unix 'lpr' program should fill
  117.     the bill.
  118.  
  119. I'll include some info for your Unix sysadmin below.
  120.  
  121. Quick Start: How to Install it
  122. ----- -----  --- -- ------- --
  123.  
  124. 1.  Install the files nlpd.exe and spooler.exe in some directory, typically
  125. \netprint or \windows.
  126.  
  127. If you can see this file, you've probably unpacked the file wslpd.zip.
  128. You've also noticed the two executables, nlpd.exe and spooler.exe.  They
  129. don't *have* to be a \netprint directory, but that's usually how I set it
  130. up for people, so that when/if I have to update the software, I know where
  131. to find the executables in a hurry.
  132.  
  133. It doesn't matter where you install the programs; they don't use the
  134. current directory anyway.
  135.  
  136. 2.  Make a few support directories.
  137.  
  138. you do have to do this:
  139.  
  140. mkdir \var
  141. mkdir \var\log
  142. mkdir \spool
  143. mkdir \spool\nlpd
  144.  
  145. [ Yes, my recent background is Unix :-) ]
  146.  
  147. These should be on the same drive as the working directory for BOTH
  148. nlpd.exe and spooler.exe.  It doesn't have to be the C drive.
  149.  
  150. Yes, a nice setup program would be a Good Thing; however, I had to start
  151. working on a different project.
  152.  
  153. 3.  Add nlpd.exe and spooler.exe to your StartUp group.
  154.  
  155. Well, they don't *have* to be in StartUp, but for many folks that will
  156. probably make the most sense.  This way you can print to your PC without
  157. intervention.
  158.  
  159. Important note:  if the 'Print Manager' isn't running then you won't be able
  160. to print to your PC.
  161.  
  162. The 'Print Manager' is the network daemon part of the Berkeley Print
  163. Protocol, and the 'Spooler' is the Microsoft Windows part, which roughly
  164. corresponds to the output filter in the Berkeley universe.
  165.  
  166. The cute icons are from the Icon Manager 1.1 package, which I picked up
  167. from the "Windows Secrets" diskette.
  168.  
  169. 4.  To the 'remote' System Administrator:
  170.  
  171. In the Berkeley world, you could set up a printcap entry with the hostname
  172. of the PC as the 'remote machine' entry.  Windows does not have the concept
  173. of a printer ID, and I didn't layer one on top in this software, so you can
  174. use any arbitrary text string as the printer ID; however, it is still
  175. required by the protocol.
  176.  
  177. The Ultrix hosts I print from have a printcap entry looks like this:
  178.  
  179. pebbles|pebbles printer:\
  180.     :lp=:\
  181.     :of=/usr/lib/lpdfilters/lpf:\
  182.     :mx#0:\
  183.     :rm=pebbles:\
  184.     :rp=lp0:\
  185.     :sd=/usr/spool/lpd:\
  186.     :lf=/usr/adm/lpd-errs:
  187.  
  188. I had an HP 720 at one time, and used SAM to set up a Berkeley compatible
  189. remote print entry.  However, there was an unfriendly router between it and
  190. "pebbles", so I have not tested printing from a System V machine.
  191.  
  192. 5.  Execute the 'Print Manager' and 'Spooler'.
  193.  
  194. You can run them from the File Manager, or restart Windows, or click on the
  195. icons, whatever.  I haven't tried the Run menu in the Program Manager.
  196.  
  197. A few other things you Need to Know
  198. - --- ----- ------ --- ---- -- ----
  199.  
  200. 1.  "NLPD" stands for "New Lpd", as the 'Print Manager' was originally
  201. called.  The goal was to make a compatible print daemon which to a remote
  202. print client would be indistinguishable from a Unix program, but would
  203. still fit comfortably under Windows.
  204.  
  205. I started with the free Berkeley 'lpd' code, but soon gave up as it was
  206. oriented towards Unix and inherited file descriptors.  There are about
  207. four lines of code remaining from lpd which have to do with checking the
  208. range on the client port.  I left in the Berkeley copyright, but the rest
  209. is totally new.
  210.  
  211. 2.  The way the two programs work follows:
  212.  
  213. *   The remote print requestor (usually 'lpd') contacts the 'Print
  214.     Manager'.  All network protocol takes place between these two programs.
  215.  
  216. *   The end result of a print request (as opposed to one of the other
  217.     commands) is a 'control file' and one or more data files.  The control
  218.     file specifies all manner of things about the print request, such as
  219.     the requestor's ID and host, the optional title, number of copies, etc.
  220.     This stuff is written to the directory "\spool\nlpd".  I suppose it
  221.     should really be "\var\spool\nlpd".
  222.  
  223. *   After a print request is finished, the 'Print Manager' will post a
  224.     message to the 'Spooler' using the Windows function "PostMessage".  The
  225.     upshot of this is that the 'Spooler' will kick in if it is running, but
  226.     if it's not running, the 'Print Manager' continues to run unimpeded.
  227.  
  228.     This means that files can be queued to your machine, and that you can
  229.     control whether it is printed now or later.  It's manual but it
  230.     gives you more control over your machine.  The way queue files
  231.     without actually printing them is to simply exit the 'Spooler'.
  232.  
  233.     To print files that have been queued but not printed, start up the
  234.     'Spooler' and select "Print" from the "File" menu.  Or, use a 'start
  235.     printer' command from a remote machine.  I have done this using "lpc"
  236.     on an Ultrix system.
  237.  
  238. *   The remote user can 'see' items in the queue up until the 'Spooler'
  239.     processes the item.  After that, they will be visible only in the
  240.     Windows Print Manager queue.
  241.  
  242. 3.  The 'Spooler' understands the following control characters:
  243.  
  244.     TAB:  Goes to the next tab stop, using eight character tabs.
  245.  
  246.     Backspace:  writes the next character to a 'shadow' buffer, so that you
  247.         can get underlining.  I haven't tested this technique with 'bold'
  248.     but it should work.
  249.  
  250.     Form feed:  does a page eject.
  251.  
  252. 4.  A word about the 'Spooler':  it does basic, generic Windows printing.
  253.     No fancy fonts, no margin control.  There is a "Printer Setup" dialog
  254.     but I'm not convinced it works right.  You're probably better off using
  255.     the Windows Print Manager to control setup.
  256.  
  257. 5.  The 'Print Manager' has a nice status window that tells you what's
  258.     happening, as it happens.  My only complaint is that it goes by too
  259.     quickly, and that the 'control file' is typically sent last so you miss
  260.     the info about the data file or files.
  261.  
  262.     The 'Spooler' has a nice status window that tells you about pages
  263.     printed and % completion, as well as requestor info.
  264.  
  265.     I have them both configured to start minimized on my PC.  The programs
  266.     don't iconify themself automatically; if someone were to show me how to
  267.     do this, I'd probably add it in later.
  268.  
  269. 6.  Here is something I really hated the first few times it happened to
  270.     me.  The 'Spooler' started out as a clone of the "printfile" program
  271.     that comes with the Microsoft C examples stuff.  Like many programs
  272.     that print to Windows, it has a little popup window that says "Now
  273.     printing <foo>".  The first time I was using PWB in full screen mode,
  274.     and someone else printed to my PC, that iconified my DOS window.  It
  275.     was most disconcerting, and other users have objected as well.
  276.  
  277.     The "Now printing" window still exists but is now optional, and is off
  278.     by default.
  279.  
  280. 7.  So, what happens when you don't have your printer configured to work
  281.     with Windows, or have no printer?  Does the software GPF?  Nope.  It
  282.     turns out that Windows intercepts the calls to the Windows printer, and
  283.     flashes a dialog on your screen to the effect that you had better
  284.     install a printer before you print.
  285.  
  286.     Conversely, what happens when you print from a Unix system, but don't
  287.     have the 'Print Manager' running?  In our case the remote "lpd" just
  288.     keeps trying now and then.  One user here printed from his Unix
  289.     workstation, and then some time later realized he wasn't running the
  290.     'Print Manager' on his PC.  He started it up, and shortly his print
  291.     jobs came rolling out.  It seems this is implementation dependent and
  292.     is handled by the print requestor.
  293.